define(function (require, exports, module){
	var Subnav = require("subnav");
	var aw = require("ajaxwrapper");
    var instance = {
    	initComponent: function (widget){
    		var subnav = new Subnav({
    			parentNode:".J-subnav",
    			model:{
    				title:"产品类型",
    				items:[{
    					id:"search",
    					type:"search",
    					placeholder:"名称",
    					handler:function(str){
    						widget.service.search({
    							s:str,
                   				properties:"name",
                   				fetchProperties: widget.constant.fetchProperties
    						},function(data){
    							widget.get("grid").setData(data);
    						});
    					}
    				},{
    					id:"seal",
    					tip: "状态",
						type:"buttongroup",
						all:{
							show:true
						},
						items:[{
							key:"false",
							value:"启用"
						},{
							key:"true",
							value:"停用"
						}],
						handler:function(key,element){
							widget.get("grid").refresh();
						}
    				},{
    					id:"add",
						type:"button",
						text:"新增",
						handler:function(){
							widget.get("form").reset();
							widget.toCard();
						}
    				},{
    					id:"return",
						type:"button",
						text:"返回",
						show:false,
						handler:function(){
							widget.toList();
						}
    				}]
    			}
    		});
    		widget.set("subnav",subnav);
        }
    };
    module.exports = instance;
});
